The present invention relates to an on-board write art of a program memory built in a single-chip microcomputer serving as a data processor, particularly to an art to be effectively applied to a single-chip microcomputer provided with a flash-type electrically erasable and programmable read only memory (hereafter referred to as a flash-type EEPROM or a flash memory).
A single-chip microcomputer (also known as a microcomputer) serving as a data processor has a built-in program memory for storing an operation program. The single-chip microcomputer executes predetermined data processing specified in the operation program stored in the built-in program memory.
The program memory has been formed with a mask-type nonvolatile memory (hereafter referred to as a mask-type read-only memory or mask ROM) or an electrically programmable nonvolatile memory (hereafter referred to as an electrically programmable read-only memory or EPROM). In recent years, however, a flash-type electrically erasable and programmable read-only memory (hereafter referred to as a flash-type EEPROM or flash memory) has been applied to a program memory.
The flash memory allows written data to be electrically erased or electrically rewritten. Therefore, a microcomputer having a built-in flash memory as a program memory has the following advantages.
Cutover of a software program (application software) developed by a user generally tends to be delayed. Therefore, it is possible to assemble the hardware for a microcomputer-applied system before the cutover of a software program and then write a developed software program in a flash memory of a microcomputer. Thereby, it is possible to quickly ship the microcomputer-applied system.
Moreover, when specification-modified software or function-added software (upgraded software or version-up software) is developed for already shipped application system software, it is possible for a user to rewrite the shipped application system software to the above newly-developed software.
That is, in the case of a microcomputer having a built-in flash memory as a program memory, the microcomputer is assembled on a printed circuit board, mounting board, or system board and then, the processing for writing an operation program in the above flash memory can be performed. In this specification, the processing for programming data in a built-in flash memory after assembling a microcomputer having the built-in flash memory on a printed circuit board, mounting board, or system board is referred to as "on-board programming" and this programming mode is referred to as "on-board programming mode".
Several methods are available to the flash memory programming. These methods are roughly divided into the following two types.
(1) The first method is referred to as a user program mode or boot mode. This mode uses a method for branching the flow of program execution by a central processing unit (CPU) built in a microcomputer to the on-board programming and changing the data in a flash memory by the CPU.
(2) The second method is referred to as a programming mode using a ROM writer. This mode uses a method for changing the data in a flash memory by external means (ROM writer) by stopping a microcomputer.
Japanese Patent Laid-Open No. 180664/1994 discloses a system for handling trouble at the time of rewriting by moving a trouble handling program to another area when rewriting a flash memory.